<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AttrEdit</title>
    <uieip type="file" value="inc" src="/yqwin/easyui/include.txt" cache="true" minute="1440"></uieip>
    <uieip type="file" value="css" src="/yqwin/css/yqwin.min" cache="false"></uieip>
    <uieip type="file" value="js" src="/yqwin/data/yqwin.min" cache="false"></uieip>
</head>

<body>
    <h2>属性数据：ui_type=17</h2>
    <h3>yqTextAttr</h3>
    <input id="tb" type="text" style="width:280px;">
    <p></p>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:isEdit_1(true)">isEdit==true</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:isEdit_1(false)">isEdit==false</a>

    <h3>yqAttrEdit</h3>
    <table id="dg" style="width:600px;height:400px;"></table>
    <p></p>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:setRow()">setRow</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:clearRow()">clear</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:getRow()">getRow</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:newLoad()">newLoad</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:isEdit(true)">isEdit==true</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:isEdit(false)">isEdit==false</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:destroy()">destroy</a>
    <script>
        $(function () {
            $('#dg').yqAttrEdit({
                titles: titles,
                row: {},
                loadDefault: true,   //加载默认值
                beforBindingTitle: function (titles, callback) {
                    console.log("beforBindingTitle", titles);
                    callback(titles);
                }, //标题绑定前
                afterBindingTitle: function () {
                    console.log("afterBindingTitle");
                },   //标题绑定后
                endEditing: function (index, row) {   //ok.....
                    console.log("endEditing", index, row);
                },

            });

            $("#tb").yqTextAttr({
                ajaxUrl: "",
                titles: titles,
                row: row,
                isEdit: true,   //可编辑
                editType: 1,  //1:属性编辑模式  2:form编辑模式
                editModeW: 450, //模态编辑器宽度 格式为 800（数字）
                editModeH: 400, //模态编辑器高度 格式为 600（数字）
                beforBindingTitle: function (titles, callback) {
                    console.log("beforBindingTitle2", titles);
                    callback(titles);
                }, //标题绑定前
                afterBindingTitle: function () {
                    console.log("afterBindingTitle2");
                },   //标题绑定后
                beforeChange: function (row, callback) {    //弹出框中的事件
                    console.log("beforeChange2", row);
                    callback(true, row);
                },
                afterChange: function (row) { //修改后
                    console.log("afterChange2", row);
                }
            });

        })

        function setRow() {
            $('#dg').yqAttrEdit("setRow", row);
        }

        function clearRow() {
            $('#dg').yqAttrEdit("clear");
        }

        function getRow() {
            var row = $('#dg').yqAttrEdit("getRow");
            console.log(row);
        }

        function newLoad() {
            $('#dg').yqAttrEdit({
                titles: titles_2,
                row: row_2
            });
        }


        function isEdit(tf) {
            $('#dg').yqAttrEdit("isEdit", tf);
        }

        function destroy() {
            $('#dg').yqAttrEdit("destroy", "forceDestroy");
        }

        function isEdit_1(tf) {
            $("#tb").yqTextAttr("isEdit", tf);
        }


        var titles = [
            {
                "name": "sid",
                "is_func": false,
                "ui_title": "sId",
                "fd_type": "nvarchar",
                "length": 36,
                "decimal": 0,
                "ui_type": 1,
                "ui_width": 90,
                "ui_visible": false,
                "ui_readonly": true,
                "ui_mask": {
                    "blank": true,
                },
                group: "group1"
            },
            {
                "name": "lable",
                "is_func": false,
                "ui_title": "Lable",
                "fd_type": "nvarchar",
                "length": 36,
                "decimal": 0,
                "ui_type": 1,
                "ui_width": 90,
                "ui_visible": true,
                "ui_readonly": true,
                "ui_mask": {
                    "default": "lable..."
                },
                "group": "group1"
            }, {
                "name": "wf",
                "ui_title": "流程设置",
                "ui_type": 15,
                "ui_width": 90,
                "ui_visible": true,
                "ui_readonly": false,
                "group": "group1",
                "ui_mask": {
                    "editModeW": 450,
                    "editModeH": 240,
                    "param": {
                        "titles": [{
                            "is_func": false,
                            "name": "type",
                            "ui_title": "项目类型",
                            "ui_type": 6,
                            "ui_width": 110,
                            "ui_visible": true,
                            "ui_readonly": false,
                            "ui_mask": {
                                "default": -1,
                                "lists": [
                                    {
                                        "no": "1",
                                        "name": "小型项目"
                                    },
                                    {
                                        "no": "2",
                                        "name": "中型项目"
                                    },
                                    {
                                        "no": "3",
                                        "name": "重大项目"
                                    }
                                ]
                            }
                        }, {
                            "is_func": false,
                            "name": "value",
                            "ui_title": "流程id",
                            "ui_type": 2,
                            "ui_width": 280,
                            "ui_visible": true,
                            "ui_readonly": false,
                            "ui_mask": {
                                "default": null,
                            }
                        }],
                        "model": []
                    }
                }
            }, {
                "name": "ui_mask",
                "is_func": false,
                "ui_title": "ui_mask",
                "fd_type": "nvarchar",
                "length": -1,
                "ui_type": 900,
                "ui_width": 80,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "ui_type": 2,
                    "pop_edit": true,    //弹出编辑模型
                    "blank": true,
                }
            },

            {
                "name": "textbox",
                "ui_title": "Textbox",
                "fd_type": "nvarchar",
                "length": 50,
                "decimal": 0,
                "ui_type": 2,
                "ui_width": 90,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": "默认值",
                    "min": 0,
                    "max": 50,
                    "blank": true,
                    "format": ""
                },
                group: "group1"
            },
            {
                "name": "checkbox",
                "is_func": false,
                "ui_title": "Checkbox",
                "fd_type": "boolean",
                "length": 1,
                "decimal": 0,
                "ui_type": 3,
                "ui_width": 30,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": true
                },
                group: "group2"
            },
            {
                "name": "datebox",
                "is_func": false,
                "ui_title": "Datetbox",
                "fd_type": "date",
                "length": 0,
                "decimal": 0,
                "ui_type": 4,
                "ui_width": 80,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": "2022-01-01",
                    "min": "2000-01-01",
                    "max": "2099-12-31",
                    "blank": true,
                    "format": "yyyy-MM-dd"
                },
                group: "group2"
            },
            {
                "name": "richbox",
                "is_func": false,
                "ui_title": "Richbox",
                "fd_type": "nvarchar",
                "length": 2000,
                "decimal": 0,
                "ui_type": 5,
                "ui_width": 90,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": "默认值",
                    "min": 0,
                    "max": 50,
                    "blank": false,
                    editModeW: 400,
                    editModeH: 200,
                },
                group: "group2"
            },
            {
                "name": "combobox",
                "is_func": false,
                "ui_title": "Combobox",
                "fd_type": "int",
                "length": 16,
                "decimal": 0,
                "ui_type": 6,
                "ui_width": 90,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": 2,
                    "blank": false,
                    "lists": [
                        {
                            "no": 0,
                            "name": "000000"
                        },{
                            "no": 1,
                            "name": "111111"
                        },
                        {
                            "no": 2,
                            "name": "222222"
                        },
                        {
                            "no": 3,
                            "name": "333333"
                        }
                    ]
                },
                group: "group2"
            },
            {
                "name": "foreignkey",
                "is_func": false,
                "ui_title": "ForeignKey",
                "fd_type": "nvarchar",
                "length": 36,
                "decimal": 0,
                "ui_type": 7,
                "ui_width": 180,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": null,
                    "blank": true,
                    "dbName": "yqbase",
                    "tbName": "sys.sys_table",
                    "tempNo": -1,
                    "displayType": 1,
                    "valueMember": "sid",
                    "displayMember": "textbox",
                    "isPage": true,
                    "pageSize": 10,
                    "addWhere": "",
                    "order": "textbox",
                    "panelWidth": 400,
                    "panelHeight": 260,
                    "expandMember": null,
                    "isSeek": false,
                    "seekNo": -1,
                    "seekModeW": 800,
                    "seekModeH": 600
                },
                group: "group3"
            },
            {
                "name": "treeselect1",
                "is_func": false,
                "ui_title": "TreeSelect1",
                "fd_type": "int",
                "length": 16,
                "decimal": 0,
                "ui_type": 8,
                "ui_width": 90,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": [
                        2,
                        201,
                        20101
                    ],
                    "blank": false,
                    "level": 1,
                    "subfield": "treeselect2",
                    "trees": [
                        {
                            "no": 1,
                            "name": "root1",
                            "extend": "扩展",
                            "default": true,
                            "subs": [
                                {
                                    "no": 101,
                                    "name": "sub101",
                                    "subs": [
                                        {
                                            "no": 10101,
                                            "name": "三级10101"
                                        },
                                        {
                                            "no": 10102,
                                            "name": "三级10102"
                                        }
                                    ]
                                },
                                {
                                    "no": 102,
                                    "name": "sub102",
                                    "subs": [
                                        {
                                            "no": 10201,
                                            "name": "三级10201"
                                        },
                                        {
                                            "no": 10202,
                                            "name": "三级10202"
                                        }
                                    ]
                                }
                            ]
                        },
                        {
                            "no": 2,
                            "name": "root2",
                            "subs": [
                                {
                                    "no": 201,
                                    "name": "Sub201",
                                    "subs": [
                                        {
                                            "no": 20101,
                                            "name": "三级20101"
                                        },
                                        {
                                            "no": 20102,
                                            "name": "三级20102"
                                        }
                                    ]
                                },
                                {
                                    "no": 202,
                                    "name": "Sub202",
                                    "subs": [
                                        {
                                            "no": 20201,
                                            "name": "三级20201"
                                        },
                                        {
                                            "no": 20202,
                                            "name": "三级20202"
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                },
                group: "group3"
            },
            {
                "name": "treeselect2",
                "is_func": false,
                "ui_title": "TreeSelect2",
                "fd_type": "int",
                "length": 16,
                "decimal": 0,
                "ui_type": 8,
                "ui_width": 90,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "blank": false,
                    "level": 2,
                    "subfield": "treeselect3",
                    "trees": []
                },
                group: "group3"
            },
            {
                "name": "treeselect3",
                "is_func": false,
                "ui_title": "TreeSelect3",
                "fd_type": "int",
                "length": 16,
                "decimal": 0,
                "ui_type": 8,
                "ui_width": 90,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "blank": false,
                    "level": 3,
                    "subfield": "",
                    "trees": []
                },
                group: "group3"
            },
            {
                "name": "numberbox",
                "is_func": false,
                "ui_title": "Numberbox",
                "fd_type": "number",
                "length": 10,
                "decimal": 2,
                "ui_type": 9,
                "ui_width": 90,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": 100,
                    "min": 0,
                    "max": 20000,
                    "precision": 2,
                    "groupSeparator": ",",
                    "blank": true
                },
                group: ""
            },
            {
                "name": "numberspinner",
                "is_func": false,
                "ui_title": "Numberspinner",
                "fd_type": "number",
                "length": 10,
                "decimal": 0,
                "ui_type": 10,
                "ui_width": 90,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": 100,
                    "min": -10,
                    "max": 10000,
                    "groupSeparator": ",",
                    "blank": false
                },
                group: ""
            },
            {
                "name": "timespinner",
                "is_func": false,
                "ui_title": "TimeSpinner",
                "fd_type": "varchar",
                "length": 8,
                "decimal": 0,
                "ui_type": 11,
                "ui_width": 80,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": "12:00",
                    "min": "06:00",
                    "max": "18:00",
                    "seconds": false,
                    "blank": true
                },
                group: ""
            },
            {
                "name": "datetimebox",
                "is_func": false,
                "ui_title": "DateTimebox",
                "fd_type": "datetime",
                "length": 0,
                "decimal": 0,
                "ui_type": 12,
                "ui_width": 80,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": "2022-01-01 00:00",
                    "min": "2000-01-01 00:00",
                    "max": "2099-12-31 00:00",
                    "blank": false,
                    "seconds": false,
                    "format": "yyyy-MM-dd hh:mm"
                },
                group: ""
            },
            {
                "name": "checkbox_2",
                "is_func": true,
                "ui_title": "Checkbox_2",
                "fd_type": "boolean",
                "length": 1,
                "decimal": 0,
                "ui_type": 0,
                "ui_width": 30,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": true
                },
                "func": "{checkbox}?'是':'否'",
                group: ""
            },
            {
                "name": "isdel",
                "is_func": false,
                "ui_title": "IsDel",
                "fd_type": "boolean",
                "length": 1,
                "decimal": 0,
                "ui_type": 3,
                "ui_width": 50,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": true
                },
                group: ""
            },
            {
                "name": "state",
                "is_func": false,
                "ui_title": "State",
                "fd_type": "int",
                "length": 16,
                "decimal": 0,
                "ui_type": 6,
                "ui_width": 90,
                "ui_visible": true,
                "ui_readonly": true,
                "ui_mask": {
                    "default": 2,
                    "blank": false,
                    "lists": [
                        {
                            "no": 0,
                            "name": "草稿"
                        },
                        {
                            "no": 1,
                            "name": "已提交"
                        },
                        {
                            "no": 9,
                            "name": "已完成"
                        }
                    ]
                },
                group: ""
            }
        ];

        var row = {
            "sid": "sid-1",
            "lable": "Lable-1",
            "textbox": "Textbox-1",
            "checkbox": true,
            "datebox": "2022/11/04",
            "richbox": "Richbox-1",
            "combobox": 2,
            "foreignkey": "foreignkey-1",
            "treeselect1": 1,
            "treeselect2": 201,
            "treeselect3": 20101,
            "numberbox": 10001.0199,
            "numberspinner": 9,
            "timespinner": "11:11",
            "datetimebox": "2022/11/04 11:11",
            "isdel": true,
            "state": 9
        };

        var titles_2 = [
            {
                "name": "textbox",
                "ui_title": "Textbox",
                "fd_type": "nvarchar",
                "length": 50,
                "decimal": 0,
                "ui_type": 2,
                "ui_width": 90,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": "默认值",
                    "min": 0,
                    "max": 50,
                    "blank": false,
                    "format": ""
                }
            },
            {
                "name": "checkbox",
                "is_func": false,
                "ui_title": "Checkbox",
                "fd_type": "boolean",
                "length": 1,
                "decimal": 0,
                "ui_type": 3,
                "ui_width": 30,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": true
                }
            },
            {
                "name": "datebox",
                "is_func": false,
                "ui_title": "Datetbox",
                "fd_type": "date",
                "length": 0,
                "decimal": 0,
                "ui_type": 4,
                "ui_width": 80,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": "2022-01-01",
                    "min": "2000-01-01",
                    "max": "2099-12-31",
                    "blank": true,
                    "format": "yyyy-MM-dd"
                }
            },
            {
                "name": "treeselect1",
                "is_func": false,
                "ui_title": "TreeSelect1",
                "fd_type": "int",
                "length": 16,
                "decimal": 0,
                "ui_type": 8,
                "ui_width": 90,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "default": [
                        2,
                        201,
                        20101
                    ],
                    "blank": false,
                    "level": 1,
                    "subfield": "treeselect2",
                    "trees": [
                        {
                            "no": 1,
                            "name": "root1",
                            "extend": "扩展",
                            "default": true,
                            "subs": [
                                {
                                    "no": 101,
                                    "name": "sub101",
                                    "subs": [
                                        {
                                            "no": 10101,
                                            "name": "三级10101"
                                        },
                                        {
                                            "no": 10102,
                                            "name": "三级10102"
                                        }
                                    ]
                                },
                                {
                                    "no": 102,
                                    "name": "sub102",
                                    "subs": [
                                        {
                                            "no": 10201,
                                            "name": "三级10201"
                                        },
                                        {
                                            "no": 10202,
                                            "name": "三级10202"
                                        }
                                    ]
                                }
                            ]
                        },
                        {
                            "no": 2,
                            "name": "root2",
                            "subs": [
                                {
                                    "no": 201,
                                    "name": "Sub201",
                                    "subs": [
                                        {
                                            "no": 20101,
                                            "name": "三级20101"
                                        },
                                        {
                                            "no": 20102,
                                            "name": "三级20102"
                                        }
                                    ]
                                },
                                {
                                    "no": 202,
                                    "name": "Sub202",
                                    "subs": [
                                        {
                                            "no": 20201,
                                            "name": "三级20201"
                                        },
                                        {
                                            "no": 20202,
                                            "name": "三级20202"
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                },
                group: "group1"
            },
            {
                "name": "treeselect2",
                "is_func": false,
                "ui_title": "TreeSelect2",
                "fd_type": "int",
                "length": 16,
                "decimal": 0,
                "ui_type": 8,
                "ui_width": 90,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "blank": false,
                    "level": 2,
                    "subfield": "treeselect3",
                    "trees": []
                },
                group: "group1"
            },
            {
                "name": "treeselect3",
                "is_func": false,
                "ui_title": "TreeSelect3",
                "fd_type": "int",
                "length": 16,
                "decimal": 0,
                "ui_type": 8,
                "ui_width": 90,
                "ui_visible": true,
                "ui_readonly": false,
                "ui_mask": {
                    "blank": false,
                    "level": 3,
                    "subfield": "",
                    "trees": []
                },
                group: "group1"
            },
        ];

        var row_2 = {
            "textbox": "Textbox-2",
            "checkbox": false,
            "datebox": "2021/01/01",
            "treeselect1": 2,
            "treeselect2": 201,
            "treeselect3": 20101
        };

    </script>
</body>

</html>